package com.googlecode.sparda.commons.collection;

import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

public final class Collections {

	public static <E, C extends Collection<E>> C toCollection(C result, E... elements) {
		for (E element : elements) {
			result.add(element);
		}
		return result;
	}
	
	public static <E> List<E> toList(E... elements) {
		return toCollection(new LinkedList<E>(), elements);
	}
	
	public static <E> Set<E> toSet(E... elements) {
		return toCollection(new HashSet<E>(), elements);
	}
	
}
